<html>

<head>

</head>

<body>

    <input type="button" value="获取数据" id="btn" />
    <script src="../node_modules/jquery/dist/jquery.min.js"></script>
    <script>
        window.onload = function() {
            $(function() {
                $('btn').on('click', function() {
                    $.ajax({
                        url: './code.json',
                        type: 'get',
                        dataType: 'json',
                        success: function(data) {
                            console.log(data)
                        }
                    })
                })
            });
        }
    </script>
</body>

</html>